<template>
  <div class="person">人员管理系统 : <i>新增会员</i></div>

  <el-form class="from1" label-position="right" label-width="100px" :model="vip">
    <p>新增会员</p>
    <div class="vip_info">会员信息:</div>
    <el-form-item label="会员类型:" prop="tips" :required="true">
      <el-select v-model="vip.tips" placeholder="请选择">
        <el-option label="白银会员" value="白银会员" />
        <el-option label="黄金会员" value="黄金会员" />
        <el-option label="铂金会员" value="铂金会员" />
      </el-select>
    </el-form-item>
    <el-form-item label="联系方式:" prop="tel">
      <el-input v-model="vip.tel" placeholder="请输入号码" class="tel_input" />
    </el-form-item>
    <el-form-item label="密码:" prop="password">
      <el-input v-model="vip.password" placeholder="请输入密码" class="tel_input" />
    </el-form-item>
    <el-form-item label="卡号:" prop="idCard">
      <el-input v-model="vip.idCard" placeholder="手机号后四位为卡号" class="tel_input" />
    </el-form-item>
    <div class="vip_info">充值:</div>
    <el-form-item label="充值方式:" prop="fanshi">
      <el-radio-group v-model="vip.fanshi" text-color="#fff" fill="#ffae00">
        <el-radio-button label="微信" class="radio_btn" />
        <el-radio-button label="银行卡" class="radio_btn" />
        <el-radio-button label="支付宝" class="radio_btn" />
        <el-radio-button label="现金" class="radio_btn" />
      </el-radio-group>
    </el-form-item>
    <el-form-item label="充值套餐:" prop="tel">
      <el-radio-group v-model="vip.taocan" text-color="#fff" fill="#ffae00">
        <el-radio-button label="充1000送200" class="radio_btn" />
        <el-radio-button label="充2000送500" class="radio_btn" />
      </el-radio-group>
    </el-form-item>
    <el-form-item label="自定义充值:" prop="tel">
      <el-input v-model="vip.zidingyi" placeholder="请输入充值金额" class="tel_input" />
    </el-form-item>
    <div class="vip_info">备注说明:</div>
    <el-input v-model="vip.textarea" maxlength="30" placeholder="请输入内容" show-word-limit type="textarea" class="tel_input textarea" />
    <el-button type="primary" @click="onSubmit" class="sure">确定</el-button>
  </el-form>
</template>

<script setup>
import { reactive, ref } from 'vue'
import { addVipApi, vipApi } from '@/api/api.js'
import { useRouter } from 'vue-router'
import { useStore } from 'vuex'
import '@/mock/vipInfo.js'
const router = useRouter()
const store = useStore()
//定义值

const textarea = ref('')
const vip = reactive({
  tips: '',
  tel: '',
  password: '',
  idCard: '',
  fanshi: '',
  taocan: '',
  zidingyi: '',
})

// 设置当前页数为1
const currentPage = ref(1)

//提交确定
const onSubmit = async () => {
  // console.log(store.state.id)
  // vip.id = store.state.id + 1
  const res = await addVipApi({ state: vip })
  console.log(res)
  router.push('/home/renyuan/huiyuan')
}
</script>

<style lang="less" scoped>
.person {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;

  i {
    font-weight: 700;
    font-size: 16px;
  }
}
.from1 {
  width: 100%;
  // height: 300px;
  text-align: center;
  // background-color: rgba(224, 243, 56, 0.459);
  background-color: rgb(238, 237, 237);
  // background-color: rgba(255, 255, 255, 0.952);

  // background-color: rgba(255, 255, 255, 0.822);

  p {
    height: 30px;
    font-weight: 700;
    line-height: 30px;
    font-size: 16px;
  }

  .vip_info {
    text-align: left;
    height: 30px;
    line-height: 30px;
    font-weight: 700;
    // background-color: rgb(156, 154, 154);
    background-color: rgba(192, 212, 169, 0.87);

    // background-color: rgba(216, 247, 132, 0.863);

    margin: 6px 0;
  }
  .tel_input {
    width: 200px;
    --el-input-focus-border-color: #ffae00;
  }

  .tel_input:focus {
    border: 1px solid #ffae00;
  }
  .radio_btn {
    // border: 1px solid rgb(192, 189, 36);
    border-radius: 20px;
    margin: 0 3px;
    // background-color: #ffae00;
  }
  .textarea {
    width: 100%;
  }
  .sure {
    margin-top: 20px;
  }
}
</style>
